/**
 * Created by yangl on 2017/8/16.
 */
var productTryController={
    init:function(){
        $("#submittry").click(function(){
            productTryController.save();
        });
    },
    save:function(){
        var form = $('#orderform').serializeJSON();
        form.type=1
        $.ajax({
            type: "post",
            url: "/custom/product/data/createorder",
//                cache:false,
//                async:false,
//             dataType: "json",
            data:form,
            success: function(json){
                console.log("json"+json);
                if(json == "提交成功"){
                    $('#myModal').modal('show')
                    $('#myModal').on('hide.bs.modal', function () {
                        window.location.href=basePath+"/custom/usercenter/page?type=tabs2";
                    })
                }else{
                    alert(json);
                }
            },
            failure:function (result) {
                console.log("提交失败");
            }
        });
    }
}

$(function(){
    productTryController.init();
})
